﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace DataService
{
    /// <summary>
    /// Summary description for CacheService
    /// </summary>
    public class FCLCacheService<T> : ICacheService<T>
    {
        private Dictionary<string,T> dic;
        private IList<T> list;
        public FCLCacheService()
        {
            dic = new Dictionary<string,T>();
            list = new List<T>();
        }


        public void Add(string key, T value)
        {
            dic.Add(key, value);
        }

        public void Add(T value)
        {
            list.Add(value);
        }

        public T GetValue(string key)
        {
            return dic[key];
        }

        public IList<T> GetValues()
        {
            return list;
        }

        public void Remove(string key)
        {
            dic.Remove(key);
        }

        public void RemoveAll()
        {
            list.Clear();
        }

        public void RemoveAllWithKey()
        {
            dic.Clear();
        }
    }
}